class DomListener {
  constructor(node, type, handler, options) {
      this._node = node;
      this._type = type;
      this._handler = handler;
      this._options = options || false;
      this._node.addEventListener(this._type, this._handler, this._options);
  }
  dispose() {
      if (!this._handler) {
          // Already disposed
          return;
      }
      this._node.removeEventListener(this._type, this._handler, this._options);
      // Prevent leakers from holding on to the dom or handler func
      this._node = null;
      this._handler = null;
  }
}
export function addDisposableListener(node, type, handler, useCaptureOrOptions) {
  return new DomListener(node, type, handler, useCaptureOrOptions);
}
